
CXX := g++
RM := rm -rf
MKDIR := mkdir -p

# MAC
#INCS := -I/usr/local/include
#LIBS := -L/usr/local/lib -lboost_thread-mt -lboost_system
# Other
INCS :=
LIBS := -lboost_thread -lboost_system

CXXFLAGS := -DDEBUG -D_GNU_SOURCE -O0 -g3 -Wall -std=c++0x -fmessage-length=0 $(INCS)
BUILD_ROOT := Build
TARGET := $(BUILD_ROOT)/Test3.exe

CXX_SRC += \
	BFX/DateTime.cpp \
	BFX/RCObject.cpp \
	BFX/SocketError.cpp \
	BFX/Socket.cpp \
	BFX/FDSet.cpp \
	BFX/SelectableChannel.cpp \
	BFX/Selector.cpp \
	BFX/SelectionKey.cpp \
	BFX/SelectInterrupter.cpp \
	BFX/TcpListener.cpp \
	BFX/TcpClient.cpp \

CXX_SRC += \
	main.cpp 

OBJS := $(patsubst %.cpp,$(BUILD_ROOT)/%.o,$(CXX_SRC))
DEPS := $(patsubst %.cpp,$(BUILD_ROOT)/%.d,$(CXX_SRC))

all: $(TARGET)

$(BUILD_ROOT)/%.o: %.cpp
	@$(MKDIR) $(@D)
	$(CXX) -c $(CXXFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o $@ $<

$(TARGET): $(OBJS)
	$(CXX) -o $(TARGET) $(OBJS) $(LIBS)


.PHONY: all clean

clean:
	-$(RM) $(BUILD_ROOT)
